public class demo6 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1=new Thread(()->{
            int sum=0;
            for (int i = 1; i < 10; i++) {
                sum+=i;
            }
            System.out.println("sum="+sum);
        });

        Thread t2=new Thread(()->{
            int sum=0;
            for (int i = 11; i < 20; i++) {
                sum+=i;
            }
            System.out.println("sum="+sum);
        });

        Thread t3=new Thread(()->{
            int sum=0;
            for (int i = 21; i < 30; i++) {
                sum+=i;
            }
            System.out.println("sum="+sum);
        });
        t1.start();
        t1.join();
        t2.start();
        t2.join();
        t3.start();
        t3.join();
    }
}
